package br.lotr.dao;

import javax.persistence.EntityManager;

import br.lotr.entidades.Cartas;

public class CartasDao extends GenericDaoJpaImpl<Cartas, Long> {
	
	public Cartas carrega(String id) {
       	EntityManager manager = getEntityManager();
    	try {
    		manager.getTransaction().begin();
    		Cartas carta = manager.find(Cartas.class,id);
    		manager.getTransaction().commit();
    		return carta;
    	} catch (Exception e) {
    		e.printStackTrace();
    		manager.getTransaction().rollback();
    		return null;
    	} finally{
			manager.close();
		}
    }

}
